<template>
    <h1>{{ msg }}</h1>
    <div class="card">
        <button type="button" @click="count++">count is {{ count }}</button>
        <p>
            Edit
            <code>components/HelloWorld.vue</code> to test HMR
        </p>
    </div>
</template>

<script>
export default {
    name: "daw",
    data() {
        return {
            count: 0,
            hello: "world"
        }
    },
    props: ["msg"],
    methods: {
      getCityWeather(city) {
          this.axios.defaults.baseURL = "/api"
          let url = "/simpleWeather/query?city=" + encodeURI(city) + "&key=c6b31fe13ce6d2da3b525c1aad1a93ba"
          this.axios.get(url, {
              transformRequest: (data, headers) => {
                  console.log(headers)
              },headers: {
                  "name": "bingo"
              }
          }).then((res) => {
              console.log(res.data, res.status)
          })
      }
    },
    mounted() {
        this.getCityWeather("西安")
    }
}
</script>

<style scoped>

</style>